//
//  ZHBaseVewController.swift
//  onemeetingmac
//
//  Created by 张衡 on 2020/3/6.
//  Copyright © 2020 onemeeting. All rights reserved.
//

import Foundation

class ZHBaseVewController: NSViewController {
    
    override func loadView() {
        let view = NSView.init(frame: NSMakeRect(0, 0, kSet_BasicWidth, kSet_BasicHeight))
        view.wantsLayer = true
        view.layer?.backgroundColor = NSColor.white.cgColor
        self.view = view
    }
    
    override func viewWillAppear() {
        super.viewWillAppear()
        
        let windowWidth = self.view.bounds.size.width
        let windowHeight = self.view.bounds.size.height
        self.view.window?.isRestorable = false
        self.view.window?.setFrame( NSRect.init(x: (self.view.window?.frame.origin.x)!, y: (self.view.window?.frame.origin.y)!, width: windowWidth, height: windowHeight), display: false)
        self.view.window?.contentView?.frame = NSRect.init(x: 0, y: 0, width: windowWidth, height: windowHeight)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.zh_setupUI()
    }
    
    lazy var toolbar: ZHToolBar = {
        let view = ZHToolBar.init(frame: NSRect.zero)
        return view
    }()
    
    func zh_setupUI() {
        self.view.addSubview(toolbar)
        toolbar.snp.makeConstraints { (make) in
            make.top.width.centerX.equalToSuperview()
            make.height.equalTo(30)
        }
    }
}
